
<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>知医治医生就诊管理平台 - 登录</title>
    <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
    <meta name="description" content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">

    <link rel="shortcut icon" href="favicon.ico"> <link href="../../plugins/bootstrap/css/bootstrap.css" rel="stylesheet">
    <link href="../../css/font-awesome.css?v=4.4.0" rel="stylesheet">

    <link href="../../css/animate.css" rel="stylesheet">
    <link href="../../css/style.css?v=4.1.0" rel="stylesheet">
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <script>if(window.top !== window.self){ window.top.location = window.location;}</script>
</head>

<body class="gray-bg">

    <div class="middle-box text-center loginscreen  animated fadeInDown">
        <div>
            <div>

                <h1 class="logo-name">D+</h1>

            </div>
            <h3>欢迎使用 知医治医生就诊管理平台</h3>

            <div class="m-t">
                <div class="form-group">
                    <input class="form-control" placeholder="用户名" id="workNum"><span id="num"></span>
                </div>
                <div class="form-group">
                    <input class="form-control" placeholder="密码" id="workPwd"><span id="pwd"></span>
                </div>
                <button class="btn btn-primary block full-width m-b" id="submit">登 录</button>

            </div>
        </div>
    </div>

    <!-- 全局js -->
    <script src="../../plugins/jquery/jquery.min.js"></script>
    <script src="../../plugins/bootstrap/js/bootstrap.min.js"></script>
    <script>

        $("#submit").click(function () {
            var workNum = document.getElementById("workNum").value;
            var workPwd = document.getElementById("workPwd").value;
            console.log(workNum);
            console.log(workPwd);

            if (workNum == "" || workNum == null){
                $("#workNum").focus;
                $("#num").html("对不起，账户不能为空请重新输入");
            }else if(workPwd == "" || workPwd == null){
                $("#workPwd").focus;
                $("#pwd").html("对不起，请您输入密码");
            }else{

                $.ajax({
                    url:"/treatment/login",
                    data:{workNum:workNum,workPwd:workPwd},
                    async:true,
                    cache:false,
                    type:"POST",
                    success:function (result) {

//                        console.log(result)
//
//                        if(result.token){
//
//                            var Token = result.token;
//                            localStorage.setItem("token",Token);
//                            //$(location).attr('href',"doctorview.html?doctorId="+result.doctorId+"");
//
//                        }else{
//                            alert("用户不存在请检查您输入的账号或密码")
//                            return;
//                        }

                        if(result){
                            console.log("true");
                            $(location).attr('href',"doctorview.html?doctorId="+result.doctorlogin.doctorId+"");
                            console.log(result.doctorlogin.doctorId)
                            var Token = result.token
                            localStorage.setItem("token",Token);
                        }else {
                            alert("用户名或密码错误，请重新输入");
                            return false;
                        }

                    }
                })

            }

        });


    </script>

</body>

</html>